<!DOCTYPE html>
<html>
<head>

<title>Image gallery with interact.js inertia and snapping</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<style>
#gallery {
    position: relative;
    font-size: 20px;
}

#gallery .stage {
    width: 32em;
    height: 18em;
    display: block;
    margin: 0;
    border: solid 2px #f40;
}

#gallery .thumbnail {
    width: 6.4em;
    height: 3.6em;
    border: solid 2px #29e;
    display: inline-block;
    top: 0;
    left: 0;

    margin: 0.5em 0.5em 0 0;

    transition: opacity 0.3s, -webkit-transform 0.5s;

    -ms-touch-action: none;
    touch-action: none;
}

#gallery .thumbnail.dragging {
    transition: none;
}

#gallery .thumbnail.expanded {
    opacity: 0;
    transition: opacity 0.1s;
}

#gallery .stage {
    position: relative;
}

#gallery .stage img {
    position: absolute;

    opacity: 0;
    width: 100%;
    height: 100%;
}

#gallery .stage img.active {
    -webkit-animation-name: expand-img;
    -webkit-animation-duration: 0.5s;
    -webkit-animation-fill-mode: forwards;
    animation-name: expand-img;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}

@-webkit-keyframes expand-img {
    from {
        -webkit-transform: scale(0.3);
        opacity: 0;
    }
    to {
        -webkit-transform: scale(1);
        opacity: 1;
    }
}
@keyframes expand-img {
    from {
        transform: scale(0.3);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
</style>

<script src="../js/modernizr.js"></script>
<script src="../js/jquery-2.1.0.min.js"></script>
<script type="module" src="../../interactjs/dist/interact.js"></script>
</head>

<body>

<div id="gallery">
    <div class="stage">
        <img data-image="a" src="images/a.png">
        <img data-image="b" src="images/b.png">
        <img data-image="c" src="images/c.png">
    </div>

    <div class="thumbnails">
        <img class="thumbnail" data-for="a" src="images/a.png">
        <img class="thumbnail" data-for="b" src="images/b.png">
        <img class="thumbnail" data-for="c" src="images/c.png">
    </div>
</div>
<script src="index.js"></script>
</body>
</html>
